﻿<Window x:Class="Kiosk.Frontend.frmMain"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:lib="clr-namespace:Microsoft.Samples.KMoore.WPFSamples.Transition;assembly=J832.Wpf.BagOTricksLib"
    xmlns:util="clr-namespace:Kiosk.Utilities;assembly=Utilities"
    xmlns:uc="clr-namespace:Kiosk.UserControls;assembly=UserControls"
    Title="MDC Kiosk" Height="552" Width="855" Loaded="frmMain_Loaded" Name="wndMain" WindowState="Maximized" WindowStyle="None"
    MouseMove="Window_MouseMove" KeyUp="Window_KeyUp" MouseUp="Window_MouseUp"  MouseDown="Window_MouseDown"
    Icon="kiosk.ico">
    <Window.Resources>
        <Storyboard x:Key="ucMainTrans" >
            <DoubleAnimation From="1" To="0" Duration="0:0:0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="brdTrans"/>
            <DoubleAnimation From="0" To="1" Duration="0:0:0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ucMain" />
        </Storyboard>
    </Window.Resources>
    <Grid >
        <Grid.Background>
            <ImageBrush ImageSource="images\bg.png" Stretch="Fill" >
            </ImageBrush>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height=".6*" />
            <RowDefinition Height="3*"  />
            <RowDefinition Height=".2*"  />
        </Grid.RowDefinitions>
        <MediaElement Grid.Row="0" Grid.Column="0" Name="mediaPlayer"  LoadedBehavior="Manual"   Visibility="Collapsed" />
        
        <!-- This is the top menu bar area !-->
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width=".3*" />
                <ColumnDefinition Width=".3*" />
                <ColumnDefinition Width="1*" />
                <ColumnDefinition Width=".3*" />
                <ColumnDefinition Width=".3*" />
            </Grid.ColumnDefinitions>
            <Grid.Background>
                <ImageBrush ImageSource="images\top\topBG.png" Stretch="Fill" />
            </Grid.Background>
            <!-- Home and calendar -->
            <uc:ucImageButton Grid.Column="0" Margin="10,5,0,10" Height="Auto" Width="Auto" ButtonImage="images\top\homeBtn.png" ButtonGlow="images\top\homeGlowBtn.png" MouseUp="HomeImage_MouseUp">
            </uc:ucImageButton>

            <Grid Grid.Column="1">
                <Image Source="images\top\calender.png" Stretch="Uniform" Grid.Row="0" Grid.Column="0"  />
                <Grid Grid.Row="0" Grid.Column="0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="9.5*" />
                        <RowDefinition Height="20.75*" />
                        <RowDefinition Height="34*"  />
                        <RowDefinition Height="14.824*" >
                        </RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="19*" />
                        <ColumnDefinition Width="76*" />
                        <ColumnDefinition Width="18.614*" />
                    </Grid.ColumnDefinitions>
                    <Viewbox Grid.Row="1" Grid.Column="1" Stretch="Uniform" StretchDirection="Both">
                        <TextBlock Name="txtMonth" Text="March" TextAlignment="Center" FontWeight="Bold"  Foreground="White" VerticalAlignment="Center" />
                    </Viewbox>
                    <Viewbox Grid.Row="2" Grid.Column="1" Stretch="Uniform" StretchDirection="Both">
                        <TextBlock Name="txtDay" Text="25" FontWeight="Bold" TextAlignment="Center"  VerticalAlignment="Center"   />
                    </Viewbox>

            </Grid>
            </Grid>
            
            <!--Time and Weather-->
            <Grid  Grid.Row="0" Grid.Column="2" VerticalAlignment="Top">
                    <Grid.RowDefinitions>
                        <RowDefinition  Height="29*"  />
                        <RowDefinition Height="51*" />
                    </Grid.RowDefinitions>
                    <StackPanel  Name="pnlTimeTemp" Grid.Row="0" VerticalAlignment="Stretch"  Orientation="Horizontal" HorizontalAlignment="Center">
                    <StackPanel.Resources>
                        <Style x:Key="styleWeather" TargetType="TextBlock">
                            <Setter Property="Margin" Value="40,0,0,0" />
                            <Setter Property="TextAlignment" Value="Center"  />
                            <Setter Property="VerticalAlignment" Value="Center" />
                            <Setter Property="FontSize" Value="{Binding ElementName=pnlTimeTemp,Path=ActualHeight}" />
                        </Style>
                    </StackPanel.Resources>
                    <TextBlock Name="txtTime" FontWeight="Bold" Style="{StaticResource styleWeather}"   Text="10:30 pm" />
                    <TextBlock Name="txtTemp" FontWeight="Bold" Style="{StaticResource styleWeather}"  Text="N\A"   />
                    <Image Name="imgWeather" Stretch="Fill" Source="images/weather/NA.png" />
                    </StackPanel>
                <Image RenderTransformOrigin=".5,.5" Margin="0,10,0,0" Grid.Row="1" Source="images/KioskLogo.png" Stretch="Uniform" >
                    <Image.RenderTransform>
                        <TransformGroup>
                            <TranslateTransform Y="5" />
                            <ScaleTransform ScaleX="1.25" ScaleY="1.25" />
                        </TransformGroup>
                    </Image.RenderTransform>
                </Image>

            </Grid>

            <uc:ucImageButton Margin="10,5,0,10" Height="Auto" Width="Auto"  Grid.Column="3"  ButtonImage="images\top\directoryBtn.png" ButtonGlow="images\top\directoryGlowBtn.png" MouseUp="DirectoryImage_MouseUp">
            </uc:ucImageButton>
            <uc:ucImageButton Margin="10,5,0,10" Height="Auto" Width="Auto"  Grid.Column="4"  ButtonImage="images\top\helpBtn.png" ButtonGlow="images\top\helpGlowBtn.png" MouseUp="HelpImage_MouseUp">
            </uc:ucImageButton>
        </Grid>


        <!-- This is the main content area !-->
        <Grid Grid.Row="1" Name="grdContent">
            <Grid.RowDefinitions>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="6*" />
                <ColumnDefinition Width="88*" />
                <ColumnDefinition Width="6*" />
            </Grid.ColumnDefinitions>
            <Image Grid.Column="0" Stretch="Fill" Source="images\middle\sideBar.png" HorizontalAlignment="Left"  />

            <lib:TransitionPresenter x:Name="transUCPresenter" Grid.Row="0" Grid.Column="1">
                <lib:TransitionPresenter.Transition>
                    <lib:FadeTransition Duration="0:0:0.75" ></lib:FadeTransition>
                </lib:TransitionPresenter.Transition>
            </lib:TransitionPresenter>

            <Border Height="200" Width="600" Name="brdWarning" Opacity="0" IsHitTestVisible="False" CornerRadius="15" Grid.Row="0" Grid.Column="1" BorderBrush="Black" BorderThickness="3" >
                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="#333333"  Offset=".25"/>
                        <GradientStop Color="LightGray" Offset="1"/>
                    </LinearGradientBrush>
                </Border.Background>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="150*" />
                        <RowDefinition Height="272*" />
                    </Grid.RowDefinitions>
                    <Viewbox Stretch="Uniform" StretchDirection="Both" Grid.Row="0" >
                        <TextBlock HorizontalAlignment="Left" Text="Inactivity Detected" Margin="10,0,10,0">
                            <TextBlock.Foreground>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Color="White"  Offset=".25"/>
                                    <GradientStop Color="#BBBBBB" Offset="1"/>
                                </LinearGradientBrush>
                            </TextBlock.Foreground>
                        </TextBlock>
                    </Viewbox>
                    <TextBlock FontSize="25" Grid.Row="1" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="10,0,10,0" Foreground="White">
                        <TextBlock.Text>
                            We have detected inactivity on the Kiosk.  We will be returning to the home screen in a few seconds unless
                            you move the mouse.
                        </TextBlock.Text>
                    </TextBlock>
                </Grid>
            </Border>

            <Image RenderTransformOrigin=".5,.5"  Grid.Column="2" Stretch="Fill" Source="images\middle\sideBar.png" HorizontalAlignment="Right"  >
                <Image.RenderTransform>
                    <ScaleTransform ScaleY="1" ScaleX="-1" />
                </Image.RenderTransform>
            </Image>
        </Grid>
        <!-- This is our RSS slideshow feed reader !-->
        <lib:TransitionPresenter x:Name="transPresenter" Grid.Row="2" Grid.ColumnSpan="3">
            <lib:TransitionPresenter.Resources>
                <DataTemplate DataType="{x:Type util:RssEntry}">
                    <Grid Name="grdRSS">
                        <Grid.Background>
                            <ImageBrush x:Name="brushBottomBG"  ImageSource="images\bottom\bottomBG.png" Stretch="Fill" />
                        </Grid.Background>

                        <Grid.RowDefinitions>
                            <RowDefinition  />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1*" />
                            <ColumnDefinition Width="7*" />
                            <ColumnDefinition Width="1*" />
                        </Grid.ColumnDefinitions>
                        <DockPanel Margin="0,5,0,5" Name="pnlRSS" LastChildFill="True" Grid.Row="0" Grid.Column="1">
                            <TextBlock MouseUp="rssMouseUP"  TextTrimming="CharacterEllipsis" Name="txtRSSHeadline"  TextWrapping="NoWrap" VerticalAlignment="Center" HorizontalAlignment="Center" Cursor="Hand" 
                                       FontFamily="Segoe UI" FontSize="{Binding ElementName=pnlRSS,Path=ActualHeight}" Text="{Binding Headline}" RenderTransformOrigin="0.5,0.5" >
                                <TextBlock.Foreground>
                                    <SolidColorBrush x:Name="rssColor" Color="White" />
                                </TextBlock.Foreground>
                                <TextBlock.RenderTransform>
                                    <ScaleTransform ScaleX="1" ScaleY="1" x:Name="rssScale" />
                                </TextBlock.RenderTransform>
                            </TextBlock>      
                        </DockPanel>
                     
                    </Grid>
                </DataTemplate>
            </lib:TransitionPresenter.Resources>
            <lib:TransitionPresenter.Transition>
                <lib:TranslateTransition  Duration="0:0:0.5" StartPoint="0,1" />
            </lib:TransitionPresenter.Transition>
        </lib:TransitionPresenter>


    </Grid>
</Window>
